<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<tr:document xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:tr="http://myfaces.apache.org/trinidad"
             xmlns:mias="http://www.monsters.inc/mias"
             xmlns:c="http://java.sun.com/jstl/core">

<ui:composition template="templates/dialog.xhtml">
  <!--
       this page will render a "braveness calculator" dialog
  -->
  <ui:define name="title">#{msg.bravenessCalc}</ui:define>
  <ui:define name="content"> 
      <tr:panelFormLayout> 
        <tr:group>
          <mias:field id="age" bean="#{bravenessCalc}" readOnly="true" />
          <mias:selectField id="selectedReaction" bean="#{bravenessCalc}" type="radio"
                            items="#{bravenessCalc.childReactions}" 
                            itemValue="value" itemLabel="reactionDescription" 
                            partialSubmit="true" autoSubmit="true"/>
        </tr:group>
        <mias:field id="braveness" bean="#{bravenessCalc}"
                    partialTriggers="#{mias:getStringArray('selectedReaction')}">
          <f:convertNumber minFractionDigits="1" maxFractionDigits="1" 
                           minIntegerDigits="1" maxIntegerDigits="2" />
        </mias:field>
        <f:facet name="footer">
          <tr:panelButtonBar>
            <tr:commandButton text="#{msg.ok}">
              <tr:returnActionListener value="#{bravenessCalc.braveness}"/>
            </tr:commandButton>
            <tr:commandButton text="#{msg.cancel}" immediate="true" >
              <tr:returnActionListener />
            </tr:commandButton>
          </tr:panelButtonBar>
        </f:facet>
      </tr:panelFormLayout> 
  </ui:define>
</ui:composition>

</tr:document>